package com.example.study.commen.cdc;


import com.example.study.config.redis.RedisUtil;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.flink.streaming.api.functions.sink.SinkFunction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author lei
 * @create 2022-08-25 14:01
 * @desc
 **/
//@Component
//@Log4j2
@Slf4j
public class DataChangeSink implements SinkFunction<DataChangeInfo> {



    @Override
    public void invoke(DataChangeInfo value, Context context) {
//        RedisUtil redisUtil=new RedisUtil();
//        redisUtil.set("DataChangeInfo",value.getAfterData(),1000*60);

        log.info("收到变更原始数据:{}", value+"\n");
        // todo 数据处理;因为此sink也是交由了spring管理，您想进行任何操作都非常简单
    }
}
